import React from 'react'
// import React, { Component } from 'react'
import { Switch, Route, Redirect } from 'react-router-dom'
// import RouterView from './router/index'
// import Index from './pages/Index/Index'
const Detail = React.lazy(() => import("./pages/Detail/Detail"))
const Index = React.lazy(() => import("./pages/Index/Index"))
const Regist = React.lazy(() => import("./pages/Register/Register"))
const Login = React.lazy(() => import("./pages/Login/Login"))
const Coupon = React.lazy(() => import("./pages/Coupon/Coupon"))
const Order =React.lazy(()=>import("./pages/Order/Order"))
export default function App() {
  return (
    <React.Suspense fallback={<div>loading...</div>}>
      <Switch>
        <Route path="/detail/:id" component={Detail}></Route>
        <Route path="/index" component={Index}></Route>
        <Route path="/regist" component={Regist}></Route>
        <Route path="/login" component={Login}></Route>
        <Route path="/coupon" component={Coupon}></Route>
        <Route path="/order" component={Order}></Route>
        <Redirect path="/" to="/index"></Redirect>
      </Switch>
    </React.Suspense>
  )
}


// import React, { Component } from 'react'
// import { Switch, Route, Redirect } from 'react-router-dom'
// // import RouterView from './router/index'
// // import Index from './pages/Index/Index'
// const Detail = React.lazy(() => import("./pages/Detail/Detail"))
// const Index = React.lazy(() => import("./pages/Index/Index"))
// const Regist=React.lazy(()=>import("./pages/Register/Register"))
// const Login=React.lazy(()=>import("./pages/Login/Login"))
// const Coupon=React.lazy(()=>import("./pages/Coupon/Coupon"))
// export default class App extends Component {
//   render() {
//     return (
//       // <Index></Index>
//       <React.Suspense fallback={<div>loading...</div>}>
//         <Switch>
//           <Route path="/detail/:id" component={Detail}></Route>
//           <Route path="/index"  component={Index}></Route>
//           <Route path="/regist"  component={Regist}></Route>
//           <Route path="/login"  component={Login}></Route>
//           <Route path="/coupon" component={Coupon}></Route>
//           <Redirect path="/" to="/index"></Redirect>
//         </Switch>
//       </React.Suspense>
//     )
//   }
// }
